﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DDD4Fun.Specification
{
    public class OrSpecification<T>:CompositeSpecification<T>
    {

         private ISpecification<T> m_one;
        private ISpecification<T> m_other;

        public OrSpecification(ISpecification<T> x, ISpecification<T> y)
        {
            m_one = x;
            m_other = y;
        }

        public override bool IsSatisfiedBy(T candidate)
        {
            
            return m_one.IsSatisfiedBy(candidate) || m_other.IsSatisfiedBy(candidate);
        }
    }
}
